<!DOCTYPE html>
<html>
<head>
<title>Google TV Closure UI Library - All JsUnit Tests</title>
<script src="../closure-library/closure/goog/base.js"></script>
<script src="deps.js"></script>
<script src="alltests.js"></script>
<script>
goog.require('goog.testing.MultiTestRunner');
</script>
<link rel="stylesheet" href="../closure-library/closure/goog/css/multitestrunner.css" type="text/css">
<style>
h1 {
  font: normal x-large arial, helvetica, sans-serif;
  margin: 0;
}
p, form {
  font: normal small sans-serif;
  margin: 0;
}
#header {
  position: absolute;
  right: 10px;
  top: 13px;
}
#timeout {
  width: 35px;
}
#footer {
  margin-top: 8px;
}
a {
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
</style>
</head>
<body>
<h1>Google TV Closure UI Library  - All JsUnit Tests</h1>
<div id="runner"></div>
<!--  Use a form so browser persists input values -->
<form id="footer" onsubmit="return false">
  Settings:<br>
  <input type="checkbox" name="hidepasses" id="hidepasses" checked>
  <label for="hidepasses">Hide passes</label><br>
  <input type="checkbox" name="parallel" id="parallel" checked>
  <label for="parallel">Run in parallel</label>
  <small>(timing stats not available if enabled)</small><br>
  Timeout tests after <input type="text" name="timeout" id="timeout" value="45"> seconds
</form>
<script>
    if (typeof _allTests == 'undefined') {
      document.write('<p>No testfiles detected in alltests.js.</p>')
    } else if (typeof goog == 'undefined') {
       document.write('<p style="color: red;">'
           + 'Unable to find goog. You need to have Closure Library checked out. Run in gtv-ui-lib/closure dir:<br>'
           + 'svn checkout http://closure-library.googlecode.com/svn/trunk/ closure-library</p>');
    } else {
      var hidePassesInput = document.getElementById('hidepasses');
      var parallelInput = document.getElementById('parallel');
      var timeout = document.getElementById('timeout');

      // Create a test runner and render it.
      var testRunner = new goog.testing.MultiTestRunner()
          .setName(document.title)
          .setBasePath('./')
          .setPoolSize(parallelInput.checked ? 8 : 1)
          .setStatsBucketSizes(5, 500)
          .setHidePasses(hidePassesInput.checked)
          //.setVerbosePasses(true)
          .addTests(_allTests);
      if (timeout.value) {
        testRunner.setTimeout(timeout.value * 1000);
      }
      testRunner.render(document.getElementById('runner'));

      goog.events.listen(hidePassesInput, 'click', function(e) {
        testRunner.setHidePasses(e.target.checked);
      });

      goog.events.listen(parallelInput, 'click', function(e) {
        testRunner.setPoolSize(e.target.checked ? 8 : 1);
      });

      goog.events.listen(timeout, 'blur', function(e) {
        if (timeout.value) {
          testRunner.setTimeout(timeout.value * 1000);
        }
      });
    }
</script>
</body>
</html>
